<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
</head>

<body>
    <div id="map">
    </div>
    <script>
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        /* 1、创建一个线要素,设置几何信息 */
        //创建一个线
        var Line = new ol.Feature({
            geometry: new ol.geom.LineString([[114.30, 30.50], [118, 30.50]])
        });
        /* 设置样式信息 */
        /* Tips:线要素只需要stroke这个样式就可以了 */
        Line.setStyle(new ol.style.Style({
            //边线颜色
            stroke: new ol.style.Stroke({
                color: '#ffcc33',
                width: 5
            })
        }));
        /* source layer */
        var source = new ol.source.Vector({
            features: [Line]
        });
        //创建一个图层
        var vector = new ol.layer.Vector({
            source: source
        });
        //将绘制层添加到地图容器中
        map.addLayer(vector);
    </script>
</body>

</html>